const SPECIFIC_MACRO_PROPERTIES = {
	'macroModel': 'macro-model-editor'
}

const SPECIFIC_FETCH_PROPERTIES = {
	'fetchModel': 'fetch-model-editor'
}



/**
 * 格式说明：属性名称==对应属性编辑器的组件名称
 */
const COMMON_PROPERTIES = {
	//字段
	'name': 'name-editor',
	'label': 'label-editor',
	'labelAlign': 'labelAlign-editor',
	'type': 'type-editor',
	'defaultValue': 'defaultValue-editor',
	'placeholder': 'placeholder-editor',
	'startPlaceholder': 'startPlaceholder-editor',
	'endPlaceholder': 'endPlaceholder-editor',
	'columnWidth': 'columnWidth-editor',
	'columnHeight':'columnHeight-editor',
	'autoFullWidth': 'autoFullWidth-editor',
	'size': 'size-editor',
	'widgetSize': 'widget-size-editor',
	'showStops': 'showStops-editor',
	'displayStyle': 'displayStyle-editor',
	'buttonStyle': 'buttonStyle-editor',
	'border': 'border-editor',
	'labelWidth': 'labelWidth-editor',
	'labelHidden': 'labelHidden-editor',
	'rows': 'rows-editor',
	'required': 'required-editor',
	'requiredHint': 'requiredHint-editor',
	'validation': 'validation-editor',
	'validationHint': 'validationHint-editor',
	'resetValue': 'resetValue-editor',
	'readonly': 'readonly-editor',
	'disabled': 'disabled-editor',
	'hidden': 'hidden-editor',
	'showAllLevels': 'showAllLevels-editor',
	'clearable': 'clearable-editor',
	'editable': 'editable-editor',
	'showPassword': 'showPassword-editor',
	'textContent': 'textContent-editor',
	'htmlContent': 'htmlContent-editor',
	'format': 'format-editor',
	'valueFormat': 'valueFormat-editor',
	'filterable': 'filterable-editor',
	'allowCreate': 'allowCreate-editor',
	'remote': 'remote-editor',
	'automaticDropdown': 'automaticDropdown-editor',
	'multiple': 'multiple-editor',
	'multipleLimit': 'multipleLimit-editor',
	'contentPosition': 'contentPosition-editor',
	'optionItems': 'optionItems-editor',
	'dicTable': 'dicTable-editor',
	'keyField':'keyField-editor',
	'valueField':'valueField-editor',
	'levelField':'levelField-editor',
	'whereStr':'whereStr-editor',
	'uploadURL': 'uploadURL-editor',
	'uploadTip': 'uploadTip-editor',
	'withCredentials': 'withCredentials-editor',
	'multipleSelect': 'multipleSelect-editor',
	'limit': 'limit-editor',
	'fileMaxSize': 'fileMaxSize-editor',
	'fileTypes': 'fileTypes-editor',
	'contentHeight': 'contentHeight-editor',
	'webSite':'web-site-editor',
	'bindField':'bind-field-editor',
	'barFormat':'bar-format-editor',
	'formula':'formula-editor',
	'signType':'signType-editor',
	'constantModel':'constantModel-editor',
	'stepId':'stepId-editor',
	'docRuleModel':'docRuleModel-editor',
	'codeRuleModel':'codeRuleModel-editor',
	'dataMap': 'dataMap-editor',
	'customClass': 'customClass-editor',
	'customStyle': 'customStyle-editor',
	//容器
	'showBlankRow': 'showBlankRow-editor',
	'showRowNumber': 'showRowNumber-editor',
	'cellWidth': 'cellWidth-editor',
	'cellHeight': 'cellHeight-editor',
	'colHeight': 'colHeight-editor',
	'gutter': 'gutter-editor',
	'responsive': 'responsive-editor',
	'span': 'span-editor',
	'offset': 'offset-editor',
	'push': 'push-editor',
	'pull': 'pull-editor',
	//数据表
	'tableWidth':'table-width-editor',
	'tableHeight':'table-height-editor',
	'showIndex':'show-index-editor',
	'showCheckBox':'show-check-box-editor',
	'tableColumns':'table-columns-editor',
	'childrenTableColumns':'children-table-columns-editor',
	'showButtonsColumn':'show-buttons-column-editor',
	'tableData':'table-data-editor',
	'stripe':'stripe-editor',
	'apiObj':'api-obj-editor',
	'dbInterFace':'dbInterFace-editor',
}

const ADVANCED_PROPERTIES = {
	'min': 'min-editor',
	'max': 'max-editor',
	'precision': 'precision-editor',
	'step': 'step-editor',
	'controlsPosition': 'controlsPosition-editor',
	'minLength': 'minLength-editor',
	'maxLength': 'maxLength-editor',
	'showWordLimit': 'showWordLimit-editor',
	'prefixIcon': 'prefixIcon-editor',
	'suffixIcon': 'suffixIcon-editor',
	'switchWidth': 'switchWidth-editor',
	'activeText': 'activeText-editor',
	'inactiveText': 'inactiveText-editor',
	'activeColor': 'activeColor-editor',
	'inactiveColor': 'inactiveColor-editor',
	'lowThreshold': 'lowThreshold-editor',
	'highThreshold': 'highThreshold-editor',
	'allowHalf': 'allowHalf-editor',
	'showText': 'showText-editor',
	'showScore': 'showScore-editor',
	'range': 'range-editor',
	'vertical': 'vertical-editor',
	'plain': 'plain-editor',
	'round': 'round-editor',
	'circle': 'circle-editor',
	'icon': 'icon-editor',
	'labelIconClass': 'labelIconClass-editor',
	'labelIconPosition': 'labelIconPosition-editor',
	'labelTooltip': 'labelTooltip-editor',
	'appendButton': 'appendButton-editor',
	'appendButtonDisabled': 'appendButtonDisabled-editor',
	'buttonIcon': 'buttonIcon-editor',
	'appendText': 'appendText-editor',
	'suffixText': 'suffixText-editor'
}

const EVENT_PROPERTIES = {
	//字段
	'onCreated': 'onCreated-editor',
	'onMounted': 'onMounted-editor',
	'onClick': 'onClick-editor',
	'onInput': 'onInput-editor',
	'onChange': 'onChange-editor',
	'onFocus': 'onFocus-editor',
	'onBlur': 'onBlur-editor',
	'onRemoteQuery': 'onRemoteQuery-editor',
	'onBeforeUpload': 'onBeforeUpload-editor',
	'onUploadSuccess': 'onUploadSuccess-editor',
	'onUploadError': 'onUploadError-editor',
	'onFileRemove': 'onFileRemove-editor',
	'onValidate': 'onValidate-editor',
	'onAppendButtonClick': 'onAppendButtonClick-editor',

	//容器
	'onSubFormRowAdd': 'onSubFormRowAdd-editor',
	'onSubFormRowInsert': 'onSubFormRowInsert-editor',
	'onSubFormRowDelete': 'onSubFormRowDelete-editor',
	'onSubFormRowChange': 'onSubFormRowChange-editor',
	//数据表
	'onPageSizeChange':'onPageSizeChange-editor',
	'onCurrentPageChange':'onCurrentPageChange-editor',
	'onSelectionChange':'onSelectionChange-editor',
	'onHideOperationButton':'onHideOperationButton-editor',
	'onDisableOperationButton':'onDisableOperationButton-editor',
	'onGetOperationButtonLabel':'onGetOperationButtonLabel-editor',
	'onOperationButtonClick':'onOperationButtonClick-editor',
	'onHeaderClick':'onHeaderClick-editor',
	'onRowClick':'onRowClick-editor',
	'onRowDoubleClick':'onRowDoubleClick-editor',
	'onCellClick':'onCellClick-editor',
	'onCellDoubleClick':'onCellDoubleClick-editor',
	'onGetRowClassName':'onGetRowClassName-editor',
	'onGetSpanMethod':'onGetSpanMethod-editor'
	//单行子表单

}

/**
 * 注册组件常见属性
 * 如属性编辑器的组件名称propEditorName设置为null，则不显示该属性编辑器！！
 * @param uniquePropName 属性名称（保证名称唯一，不跟其他组件属性冲突）
 * @param propEditorName 对应属性编辑器的组件名称
 */
export function registerCommonProperty(uniquePropName, propEditorName) {
	COMMON_PROPERTIES[uniquePropName] = propEditorName
}

/**
 * 注册组件高级属性
 * 如属性编辑器的组件名称propEditorName设置为null，则不显示该属性编辑器！！
 * @param uniquePropName 属性名称（保证名称唯一，不跟其他组件属性冲突）
 * @param propEditorName 对应属性编辑器的组件名称
 */
export function registerAdvancedProperty(uniquePropName, propEditorName) {
	ADVANCED_PROPERTIES[uniquePropName] = propEditorName
}

/**
 * 注册组件事件属性
 * 如属性编辑器的组件名称propEditorName设置为null，则不显示该属性编辑器！！
 * @param uniquePropName 属性名称（保证名称唯一，不跟其他组件属性冲突）
 * @param propEditorName 对应属性编辑器的组件名称
 */
export function registerEventProperty(uniquePropName, propEditorName) {
	EVENT_PROPERTIES[uniquePropName] = propEditorName
}

/**
 * 判断属性是否已注册
 * @param uniquePropName 属性名称（保证名称唯一，不跟其他组件属性冲突）
 */
export function propertyRegistered(uniquePropName) {
	return !!COMMON_PROPERTIES[uniquePropName] || !!ADVANCED_PROPERTIES[uniquePropName] || !!EVENT_PROPERTIES[uniquePropName]
}

/**
 * 注册常见属性对应的属性编辑器
 * @param app
 * @param uniquePropName
 * @param propEditorName
 * @param editorComponent
 */
export function registerCPEditor(app, uniquePropName, propEditorName, editorComponent) {
	app.component(propEditorName, editorComponent)
	registerCommonProperty(uniquePropName, propEditorName)
}

/**
 * 注册高级属性对应的属性编辑器
 * @param app
 * @param uniquePropName
 * @param propEditorName
 * @param editorComponent
 */
export function registerAPEditor(app, uniquePropName, propEditorName, editorComponent) {
	app.component(propEditorName, editorComponent)
	registerAdvancedProperty(uniquePropName, propEditorName)
}

/**
 * 注册事件属性对应的属性编辑器
 * @param app
 * @param uniquePropName
 * @param propEditorName
 * @param editorComponent
 */
export function registerEPEditor(app, uniquePropName, propEditorName, editorComponent) {
	app.component(propEditorName, editorComponent)
	registerEventProperty(uniquePropName, propEditorName)
}

export default {
	COMMON_PROPERTIES,
	ADVANCED_PROPERTIES,
	EVENT_PROPERTIES,
	SPECIFIC_MACRO_PROPERTIES,
	SPECIFIC_FETCH_PROPERTIES
}


